package com.zr.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zr.service.HostelSelectService;

/**
 *获取寝室信息
 * @author wxz
 *
 */
public class GetHostelSelectController extends HttpServlet{
	HostelSelectService hss = new HostelSelectService();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doPost(req, resp);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding("utf8");
		String page = req.getParameter("page");
		String rows = req.getParameter("rows");
		int pagestart=(Integer.parseInt(page)-1)*Integer.parseInt(rows);
		resp.setCharacterEncoding("utf8");
		PrintWriter pw = resp.getWriter();
		pw.write(hss.getHostel(pagestart, Integer.parseInt(rows)).toString());
	}
}
